package cn.lzx.controller;

import cn.lzx.pojo.StorePojo;
import cn.lzx.service.StoreService;
import cn.lzx.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/store")
public class StoreController {

    @Autowired
    private StoreService storeService;

    @PostMapping("/add")
    public JsonResult add(@RequestBody StorePojo storePojo){
        try {
            storeService.add(storePojo);
            return new JsonResult();
        } catch (Exception e) {
            e.printStackTrace();
            return new JsonResult(false,"添加仓库失败");
        }
    }
}
